package com.titan.core.utils.dbinfo.interfaces;

import java.sql.Connection;
import java.sql.SQLException;


/**
 * @author 周成功
 * @email 86898837@qq.com
 * @date 2020年02月20日
 */
public interface TableInfo {
    /**
     * 获得表信息
     *
     * @param conn
     * @param tablename
     * @return {表类型, 表注释}
     */
    public String[] getTableInfo(Connection conn, String tablename) throws Exception;
    public String[] getTableInfo(Connection conn, String schema, String tablename) throws Exception;
    
    
    /**
     * 获得列信息
     *
     * @param conn
     * @param tablename
     * @return {列英文名, 数据类型, 数据长度, 数值指定长度(整数+小数), 数值小数部分长度, 是否可以为null(Y/N), 列注释}
     */
    public String[][] getColumnInfo(Connection conn, String tablename) throws Exception;
    public String[][] getColumnInfo(Connection conn, String schema, String tablename) throws Exception;
    
    
    /**
     * 获得表的主键
     *
     * @param conn
     * @param tablename
     * @return
     */
    public String[] getPrimaryKey(Connection conn, String tablename) throws Exception;
    public String[] getPrimaryKey(Connection conn, String schema, String tablename) throws Exception;
    
    
    /**
     * 获得表的唯一索引
     *
     * @param conn
     * @param tablename
     * @return
     */
    public String[][] getUniqueIndex(Connection conn, String tablename) throws Exception;
    public String[][] getUniqueIndex(Connection conn, String schema, String tablename) throws Exception;
}
